package com.yituo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yituo.dao.DeptDao;
import com.yituo.service.DeptService;
import com.yituo.vo.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptDao deptDao;
    @Override
    public PageInfo<Dept> queryAllDept(int pageNum,int size) {
        PageInfo<Dept> pageInfo = new PageInfo<Dept>();
        pageInfo.setPageNum(1);
        pageInfo.setStartRow(1);
        pageInfo.setPageSize(5);
        PageHelper.startPage(pageNum,size);
        List<Dept> list = deptDao.queryAllDept();
        pageInfo.setList(list);
        return pageInfo;
    }
}
